package com.yanqu.road.server.cmd.activity.lottery;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ActivityLotteryProto;
import com.yanqu.road.pb.activity.GourdChildProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = GameProtocol.S_ACTIVITY_LOTTERY_SYNC_NOTICE, desc = "同步公告")
public class ActivityLotteryNoticeCmdFromCorss implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        ActivityLotteryProto.SyncActivityLotteryNoticeRespMsg reqMsg = ActivityLotteryProto.SyncActivityLotteryNoticeRespMsg.parseFrom(packet.getBytes());
        for (GamePlayer gamePlayer : GamePlayerMgr.getAllOnlinePlayer()) {
            gamePlayer.sendPacket(ClientProtocol.U_ACTIVITY_LOTTERY_SYNC_NOTICE, reqMsg.toBuilder());
        }
    }
}
